#! usr/bin/python

#-------------------------------------------------------------------------------
# Agitprop
# v0.00a
#
#-------------------------------------------------------------------------------
import pygame
import pymunk
from spiegel import *


class Game(SpiegelBase):
    """The basic initialisation is handled
    by SPIEGEL. The game class is a wrapper
    for the game itself's machinations."""
    def update(self):
        self.space.step(1/50.0)
    
    def draw(self):
        self.screen.fill([0, 0, 0])
        #self.screen.blit()
        for physObj in self.pymunk_list:
            if physObj.body.position.y > self.resolution[1]:
                self.space.remove(physObj.body)
                self.pymunk_list.remove(physObj)
            physObj.draw(self.screen, physObj)
            
        
    def key_down(self, key):
        if key == (pygame.K_z):
            phys_ball = PymunkBall(self.space, self.mousepos[0], self.mousepos[1])
            self.pymunk_list.append(phys_ball)
        if key == (pygame.K_x):
            phys_line = PymunkLine(self.space, self.mousepos[0], self.mousepos[1])
            self.pymunk_list.append(phys_line)
            
    def key_up(self, key):
        pass
    
    def mouse_up(self, button, pos):
        pass

    def mouse_down(self, button, pos):
        pass

    def mouse_motion(self, buttons, pos, rel):
        pass

class Vlad(object):
    def __init__(self):
        pass

    def update(self):
        pass

    def draw(self):
        pass

class GenericGuard(object):
    def __init__(self):
        pass

    def update(self):
        pass

    def draw(self):
        pass


#-------------------------------------------------------------------------------
# Execution Code
#-------------------------------------------------------------------------------

gameObj = Game((800, 600), [0, 0, 0], 'Agitprop')
gameObj.game_loop(60)
